import rxAjax from '@/assets/js/ajax.js';

//规则引擎定义 api接口
export const FormLiteFlowApi = {};

FormLiteFlowApi.baseUrl= '/api-form/form/core/formLiteFlow';
FormLiteFlowApi.exportUrl= FormLiteFlowApi.baseUrl + '/export';

//查询列表
FormLiteFlowApi.query=function (parameter) {
  var url= FormLiteFlowApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
FormLiteFlowApi.get =function(pkId) {
  var url= FormLiteFlowApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}


//保存数据
FormLiteFlowApi.save =function(parameter) {
  var url= FormLiteFlowApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
FormLiteFlowApi.del =function(parameter) {
  var url= FormLiteFlowApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}
/**
 * 更新状态
 * @param pkId
 * @returns {*}
 */
FormLiteFlowApi.uploadEnabled =function(pkId) {
    var url= FormLiteFlowApi.baseUrl + '/uploadEnabled?pkId=' + pkId;
    return rxAjax.get(url);
}

//根据类型获取处理器
FormLiteFlowApi.getLiteFlowHandlers =function(nodeType) {
    var url= FormLiteFlowApi.baseUrl + '/getLiteFlowHandlers?nodeType='+nodeType;
    return rxAjax.get(url);
}
//变更分类
FormLiteFlowApi.changeCategory=function(ids,categoryId){
    var url= FormLiteFlowApi.baseUrl+'/changeCategory';
    return rxAjax.postForm(url, {ids:ids,categoryId:categoryId});
}
export  default FormLiteFlowApi;

